#include <bits/stdc++.h>
using namespace std;
long long n, cnt = 0;
long long a[100010], t[100010], maxn = -1, minn = 1e6;
int main()
{
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
        if(t[a[i]] == 0) cnt++;
        maxn = max(maxn, a[i]);
        minn = min(minn, a[i]);
        t[a[i]]++;
    }
    if(cnt == 1)
    {
        cout << n;
        return 0;
    }
    for(int i = maxn; i > minn; i--)
    {
        if(t[i] != 0)
        {
            for(int j = 1; j < i && i - j >= minn; j++)
            {
                if(t[i - j] != 0)
                {
                    if(t[i] > t[i - j])
                    {
                        n = n - t[i - 1];
                        t[i - j] = 0;
                        t[i] -= t[i - 1];
                        i++;
                    }
                    else
                    {
                        n -= t[i];
                        t[i] = 0;
                        t[i - j] -= t[i];
                    }
                    continue;
                }
            }
        }
    }
    cout << n << endl;
    return 0;
}
